package com.jr.service.impl;

import com.jr.entry.BlogText;
import com.jr.mapper.BlogTextMapper;
import com.jr.service.BlogTextService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class BlogTextServiceImpl implements BlogTextService {
    @Autowired
    private BlogTextMapper blogTextMapper;

    @Override
    public ArrayList<BlogText> showAllBlogText(RowBounds rowBounds) {
        return blogTextMapper.selectAll(rowBounds);
    }

    @Override
    public ArrayList<BlogText> showAllBlogTexts() {
        return blogTextMapper.selectAllBlogText();
    }

    @Override
    public ArrayList<BlogText> showBlogTextByType(BlogText blogText) {
        return blogTextMapper.selectByType(blogText);
    }

    @Override
    public ArrayList<BlogText> showBlogTextByClickNumber() {
        return blogTextMapper.selectByClickNumber();
    }

    @Override
    public BlogText showBlogTextDetail(BlogText blogText) {
        return blogTextMapper.selectByBlogId(blogText);
    }


    @Override
    public ArrayList<BlogText> showSuggest(BlogText blogText) {
        return blogTextMapper.selectByTypeOderByClickNumber(blogText);
    }

    @Override
    public ArrayList<BlogText> showBackground(BlogText blogText,RowBounds rowBounds) {
        return blogTextMapper.selectByUid(blogText, rowBounds);
    }

    @Override
    public int editBlogText(BlogText blogText) {
        return blogTextMapper.updateBlogTextByBlogId(blogText);
    }

    @Override
    public int removeBlogText(BlogText blogText) {
        return blogTextMapper.deleteBlogTextByBlogId(blogText);
    }

    @Override
    public int addBlogText(BlogText blogText) {
        return blogTextMapper.insertBlogText(blogText);
    }

    @Override
    public int changeClickNumber(Integer blogid) {
        return blogTextMapper.updateClickNumber(blogid);
    }

    @Override
    public int countBlogText(BlogText blogText) {
        return blogTextMapper.countBlogText(blogText);
    }
}
